home *** CD-ROM | disk | FTP | other *** search
- Path: tribeca.ios.com!aldo
- From: aldo@tribeca.ios.com (Aldo Di Domenico)
- Newsgroups: comp.lang.c
- Subject: Re: These string questions just won't go away......
- Date: 2 Jan 1996 23:16:36 GMT
- Organization: Internet Online Services
- Message-ID: <4cceck$6cp@news2.ios.com>
- References: <4c67g1$k88@news1.usa.pipeline.com>
- NNTP-Posting-Host: tribeca.ios.com
- X-Newsreader: TIN [version 1.2 PL2]
-
- On 31 Dec 1995 14:42:09 GMT, Pete (grantp@usa.pipeline.com) wrote:
- :
- : >int
- : >main(void)
- : >{
- : >char string[] = "Strawberry Fields forever";
- : >f(&string[10]);
- : >return 0;
- : >}
- : >
- : >void
- : >f(char *input)
- : >{
- : >input--;
- : >printf(*input);
- :
- : This should cause a fault. What you probably want to do is omit
- : the dereference and use printf(input). Then it should print the
- : remainder of the string beginning with the 10th character.
- : >return;
- <other stuff snipped>
-
- OK, OK, I'm sorry. I wrote this post too hastily. What I meant to write
- was:
-
- printf("%c", *input); /* I hope I got it right this time. :) */
-
- Now, my question (which has since been answered) was about whether
- function f() would be able to "find" string[9], since f() was called with
- a pointer to string[10], and I was not sure if the program could back up
- like that. Anyway, I didn't mean to cause so much confusion with my
- sloppiness. Thanks again.
-
-
- Aldo DiDomenico
-
- "I smell a rat in Philadelphia" --Patrick Henry, explaining his boycott
- of The Constitutional Convention of 1787
-
- email: aldo@tribeca.ios.com | Visit my page for instructions on how to
- www: http://tribeca.ios.com | set up your link there.
- finger for PGP public key |
-
-